/**
 * This is a demo of client-expert mobile system.
 * Author: Akalius Kung
 * Date: 2009-4-19
 */

package com.and.constant;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class ImageTool {

	public static Bitmap genBitmapByImageUrl(String imageUrl){
		
		try {
			return BitmapFactory.decodeStream(new URL(imageUrl).openStream());
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return null;
	}
	
//    public static Bitmap genBitmapByImageFile(String imageFile){
//		
//		try {
//			InputStream is = getClass().getResourceAsStream(imageFile);
//			return BitmapFactory.decodeStream(new FileInputStream(imageFile));
//		} catch (IOException e) {
//			e.printStackTrace();
//		}
//		
//		return null;
//	}
    
    public Bitmap genBitmapByImageFile(String imageFile){
		
		InputStream is = getClass().getResourceAsStream(imageFile);

		return BitmapFactory.decodeStream(is);
	}
}
